package libraries;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;



public class DBConnect {
	public static String  mySQLDB, myDriver, myT1, myUName, myPswd;
	public static String myQuery1, myQuery2;
	public static Connection myCon = null;
	public static Statement mySt;
	public static PreparedStatement myPst;
	public static ResultSet rs1, rs2;
	public static String p1, p2;
	
	public static void GetResultSet() throws SQLException, ClassNotFoundException {
		System.out.println("in the db in in in ");
		  Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
		   myUName = "Kamna";
		   myPswd ="ktiwari";
		   mySQLDB = "jdbc:sqlserver://;servername=PAPQASQL1.IPS.LAN";
		   myCon = DriverManager.getConnection(mySQLDB, myUName, myPswd);
		   mySt = myCon.createStatement();
		 String query = "select p.parcelid,pf.routingdispositionid from parcels.hubapp.parcelorder po inner join parcels.hubapp.parcel p on po.parcelorderid = p.parcelorderid inner join parcels.hubapp.pipflow pf on p.parcelid = pf.parcelid where po.customerorderxref = 'ORAAA000000000712641'";
		   mySt = myCon.createStatement();
		   rs1 = mySt.executeQuery(query);
		       if (rs1 == null) {
				System.out.print("Empty result set");
             	}
		       while(rs1.next()){
		          String EmpNo=rs1.getString("parcelid");
		         
		          System.out.println(EmpNo);
		         }
		       myCon.close();
	 } 
   
}
	
	
 	

